{{extend 'layout.html'}}

<div class="module">
	<div class="module-body">
		<ul class="nav nav-tabs">
			{{i = 0}}
			{{for categoria_test in categorie_test:}}
				{{if i==0:}}
					<li class="active"><a href="{{='#tab_%s'%categoria_test.id}}" data-toggle="tab">{{=categoria_test.categoria_test}}</a></li>
				{{else:}}
					<li><a href="{{='#tab_%s'%categoria_test.id}}" data-toggle="tab">{{=categoria_test.categoria_test}}</a></li>
				{{pass}}
				{{i+=1}}
			{{pass}}
		</ul>
		<div class="tab-content">
			{{i = 0}}
			{{for categoria_test in categorie_test:}}
				<div class="{{='tab-pane active in' if i==0 else 'tab-pane fade'}}" id={{="tab_%s"%categoria_test.id}}>
				{{i+=1}}
						<div>
							{{=XML(categoria_test.descrizione)}}
						</div>
						<hr />
						<div>
							{{tests = db(db.test.categoria_test_id==categoria_test.id).select(orderby=(db.test.test))}}
							
							{{for test in tests:}}
								<div class="media stream">
									<a class="media-avatar medium pull-left" href="#">
										<img src="{{=URL('default', 'download', args=test.thumbnail)}}" />
									</a>
									<div class="media-body">
										<div class="stream-headline">
											<h5 class="stream-author">
												{{=test.test}}
											</h5>
											<div class="stream-text">
												{{=XML(categoria_test.descrizione)}}
											</div>
										</div>
										<div class="stream-options">
											<a class="btn btn-small" href={{=URL('sfide', 'invio_test_personale', vars={'test_id':test.id})}}>
												<i class="icon-cog shaded"></i>
												{{=T('Partecipa')}}
											</a>
										</div>
									</div>
								</div>
							{{pass}}
							
						</div>
					</div>
			{{pass}}
		</div>
	</div>
</div>